local bonu = fk.CreateSkill({
  name = "cf_bonu",
  tags = { Skill.Limited },
})

Fk:loadTranslationTable({
  ["cf_bonu"] = "勃怒",
  [":cf_bonu"] = "限定技，出牌阶段，你可以获得牌堆和弃牌堆中的所有“书”，然后你令手牌中有“书”的其他角色本回合不能使用或打出手牌直到回合结束。",
  ["$cf_bonu1"] = "这是，惩罚哦。",
  ["$cf_bonu2"] = "酥酥麻麻的哟。",
})

bonu:addEffect("active", {
  card_num = 0,
  target_num = 0,
  anim_type = "big",
  can_use = function(self, player)
    return player:hasSkill(bonu.name) and player:usedSkillTimes(bonu.name, Player.HistoryGame) == 0
  end,
  on_use = function(self, room, skillUseEvent)
    local dcard = table.filter(room.discard_pile, function(element, index, array)
      return Fk:getCardById(element):getMark("cf_bocai") > 0
    end)
    local drcard = table.filter(room.draw_pile, function(element, index, array)
      return Fk:getCardById(element):getMark("cf_bocai") > 0
    end)
    room:moveCardTo(dcard, Player.Hand, skillUseEvent.from, fk.ReasonDraw)
    room:moveCardTo(drcard, Player.Hand, skillUseEvent.from, fk.ReasonDraw)
    table.forEach(room.alive_players, function(element, index, array)
      if element ~= skillUseEvent.from then
        room:addPlayerMark(element, "cf_bonu-turn")
      end
    end)
  end,
})

bonu:addEffect("prohibit", {
  prohibit_use = function(self, player, card)
    if table.find(player:getCardIds("h"), function(element, index, array)
          return Fk:getCardById(element):getMark("cf_bocai") > 0
        end) ~= nil and player:getMark("cf_bonu-turn") > 0 then
      local subcards = card:isVirtual() and card.subcards or { card.id }
      return #subcards > 0 and
          table.every(subcards, function(id)
            return table.contains(player:getCardIds("h"), id)
          end)
    end
  end,
  prohibit_response = function(self, player, card)
    if table.find(player:getCardIds("h"), function(element, index, array)
          return Fk:getCardById(element):getMark("cf_bocai") > 0
        end) ~= nil and player:getMark("cf_bonu-turn") > 0 then
      local subcards = card:isVirtual() and card.subcards or { card.id }
      return #subcards > 0 and
          table.every(subcards, function(id)
            return table.contains(player:getCardIds("h"), id)
          end)
    end
  end,
})

return bonu
